import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2025-03-09
 * Time: 19:07
 */
public class test1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a=scanner.nextInt();
        int b=scanner.nextInt();
        int count=0;

        for(int i=a;i<=b;i++){
            int num=i;
            while(num!=0){
                if(num%10==2){
                    count++;
                }
                num/=10;
            }
        }
        System.out.println(count);
    }
}
